﻿using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using TickSharp.Core.Interfaces;
using TickSharp.Core.Model;

namespace TickSharp.Core.Infrastructure
{
    public class ClientSerializer : ISerializer
    {
        public IEnumerable<Client> Deserialize(XElement elements)
        {
            return from e in elements.Elements()
                   select new Client
                              {
                                  Id = int.Parse(e.Element("id").Value),
                                  Name = e.Element("name").Value
                              };
        }
    }
}